﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;
using System.Configuration;
using Microsoft.Practices.Unity.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace LCA.Community.DAL.Test
{
    public class BaseTestClass
    {
        private TestContext testContextInstance;
        protected IUnityContainer _unityContainer;

        protected void UnityContainerInitializer()
        {
            var fileMap = new ExeConfigurationFileMap { ExeConfigFilename = "Unity.config" };
            System.Configuration.Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
            var unitySection = (UnityConfigurationSection)configuration.GetSection("unity");

            _unityContainer = new UnityContainer().LoadConfiguration(unitySection);
        }

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }
    }
}
